﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using EFDataPager.BusinessObjects;

namespace EFDataPager.UserControls
{
    public partial class ControloListViewStandard : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            BindListView();
        }

        protected void listviewNoticias_PagePropertiesChanged(object sender, EventArgs e)
        {
            BindListView();
        }
        private void BindListView()
        {
            var data = new DadosMock();
            listviewNoticias.DataSource = data.ObterDadosMock().ToArray();
            listviewNoticias.DataBind();

            var nRows = data.ObterDadosMock().ToArray().Count();
            NumberOfRowsLoadedFromDataSource.Text = string.Format("Número de elementos carregados: {0}", nRows);
            NumberOfRowsLoadedFromDataSourceEN.Text = string.Format("Number of binded elements: {0}", nRows);
        }
    }
}